<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="js/axios-0.18.0.js"></script>
    <script type="text/javascript" src="js/vuejs-2.5.16.js"></script>
    <script type="text/javascript" src="js/MyDate.js"></script>
</head>
<body>
<div id="app">
    用户名：<input type="text" v-model="user.uname"><br>
    密码:<input type="password" v-model="user.password"><br>
    用户角色:<input type="date" v-model="user.role"><br>
    <input type="button" value="登录" @click="login">
</div>
<script type="text/javascript">
    var vm =new Vue({
        el :"#app",
        data:{
            user:{
                uname : "",
                password : "",
                role :""
            },
        },
        methods:{
            login(){
                axios.post("/userservice/toLogin",this.user).then(function(response){
                    var result = response.data;
                    if(result == "SUCC"){
                        if (this.user.role=='运营角色') {
                            axios.post("/userservice/getAllYunying").then(function (response) {

                            })
                        }else if (this.user.role=='商品中心角色'){
                            axios.post("/userservice/getAllZhongxin").then(function (response) {

                            })
                        }
                    }else{
                        alert("登录异常");
                        location.href="/userservice/login"
                    }
                });
            }
        }
    });

</script>
</body>
</html>